import { MdIconRegistry } from '@angular/material';
import { DomSanitizer } from '@angular/platform-browser';

export const loadSvgResource = (ir: MdIconRegistry, ds: DomSanitizer) => {
    //svg路径
    const svgPath: string = 'assets/';
    //日期svg
    const daysPath: string = `${svgPath}days/`;
    //头像集合svg
    const avatarsPath: string = `${svgPath}avatars/`;

    const dates: Array<number> = [
        1, 2, 3, 4, 5, 6, 7, 8, 9,
        11, 12, 13, 14, 15, 16, 17, 18, 19,
        21, 22, 23, 24, 25, 26, 27, 28, 29,
        31
    ];
    ir.addSvgIcon('owl', ds.bypassSecurityTrustResourceUrl('assets/猫头鹰.svg'));
    ir.addSvgIcon('day', ds.bypassSecurityTrustResourceUrl('assets/日.svg'));
    ir.addSvgIcon('week', ds.bypassSecurityTrustResourceUrl('assets/周.svg'));
    ir.addSvgIcon('month', ds.bypassSecurityTrustResourceUrl('assets/月.svg'));
    ir.addSvgIcon('time_table', ds.bypassSecurityTrustResourceUrl('assets/时间表.svg'));
    ir.addSvgIcon('project', ds.bypassSecurityTrustResourceUrl('assets/项目.svg'));
    ir.addSvgIcon('index', ds.bypassSecurityTrustResourceUrl('assets/首页.svg'));

    dates.forEach((el: number) => {
        ir.addSvgIcon(`day${el}`, ds.bypassSecurityTrustResourceUrl(`${daysPath}day${el}.svg`));
    });

    ir.addSvgIconSetInNamespace('avatars', ds.bypassSecurityTrustResourceUrl(`${avatarsPath}avatars.svg`));
}